package org.puremvc.as3.fi.patterns.proxy 
{
	import org.puremvc.as3.fi.interfaces.IFacadeInjected;
	import org.puremvc.as3.fi.patterns.observer.Notifier;
	import org.puremvc.as3.multicore.interfaces.INotifier;
	import org.puremvc.as3.multicore.interfaces.IProxy;

	/**
	 * @author a.fell
	 */
	public class Proxy extends Notifier implements IProxy, INotifier, IFacadeInjected 
	{
		public static var NAME:String = 'Proxy';
		
		/**
		 * Constructor
		 */
		public function Proxy( proxyName:String=null, data:Object=null ) 
		{
			
			this.proxyName = (proxyName != null)?proxyName:NAME; 
			if (data != null) setData(data);
		}

		/**
		 * Get the proxy name
		 */
		public function getProxyName():String 
		{
			return proxyName;
		}		
		
		/**
		 * Set the data object
		 */
		public function setData( data:Object ):void 
		{
			this.data = data;
		}
		
		/**
		 * Get the data object
		 */
		public function getData():Object 
		{
			return data;
		}		
		
		/**
		 * Called by the Model when the Proxy is registered
		 */ 
		public function onRegister( ):void {}

		/**
		 * Called by the Model when the Proxy is removed
		 */ 
		public function onRemove( ):void {}
		
		// the proxy name
		protected var proxyName:String;
		
		// the data object
		protected var data:Object;
	}
}
